function Draw_Base()
{
	Object_Attr.apply(this, arguments);
	// id
	this.id = null;
	// 图片名称
	this.name = null;
	// 描述图片资源是什么
	this.discribe = null;
	// 位置信息 一个绘图信息需要位置才完整
	this.position = null;
	// context
	this.ctx = null;
}
extend_usemid(Draw_Base, Object_Attr);
/**
 * 生成位置信息
 */
Draw_Base.prototype.genPosition = function(x, y, w, h)
{
	this.position = new Position_Normal(x, y, w, h);
}

Draw_Base.prototype.drawSelf = function(a_imagesrc, a_position)
{
	var _img = new Image();
	var x = a_position.x + a_position.dx;
	var y = a_position.y + a_position.dy;
	var w = a_position.w + a_position.dw;
	var h = a_position.h + a_position.dh;
	// alert(x + " " + y + " " + w + " " + h);
	_img.src = a_imagesrc;
	_img.onload = function()
	{
		game.ctx.drawImage(_img, x, y, w, h);
	}
}

Draw_Base.prototype.cleanSelf = function(a_position)
{
	this.ctx.clearRect(a_position.x + a_position.dx, a_position.y
			+ a_position.dy, a_position.w, a_position.h);
}

// 给自己描边
Draw_Base.prototype.strokeSelf = function(color)
{
	// 移动到目标上 描边效果
	ctx.beginPath();
	ctx
			.rect(this.position.x, this.position.y, this.position.w,
					this.position.h);
	ctx.lineWidth = 2;
	ctx.strokeStyle = color;
	ctx.stroke();
}
/**
 * draw的基类方法而已
 */
Draw_Base.prototype.draw = function()
{
	// ...
}

// ///////////////////////////////////////////

function Draw_Normal()
{
	Draw_Base.apply(this, arguments);
	this.ctx = game.ctx;
}
extend_usemid(Draw_Normal, Draw_Base);

// //////////////////////////

/**
 * 画出图片的
 */
function Draw_Image()
{
	Draw_Normal.apply(this, arguments);
	// 房间图片样式
	this.drawable = new Image();
}
extend_usemid(Draw_Image, Draw_Normal);

Draw_Image.prototype.genImage = function(src)
{
	this.drawable.src = src;
}
/**
 * 画图片
 */
Draw_Image.prototype.draw = function()
{
	if (this.drawable.src !== null && this.drawable.src !== "")
	{
		// 一些条件满足才画
		if (this.position !== undefined && this.position !== null
				&& this.position.x !== undefined && this.position.x !== null
				&& this.position.y !== undefined && this.position.y !== null)
		{
			var x = this.position.x + this.position.dx;
			var y = this.position.y + this.position.dy;
			var w = this.position.w + this.position.dw;
			var h = this.position.h + this.position.dh;
			this.ctx.drawImage(this.drawable, x, y, w, h);
		}
	}
}

/**
 * 画出文字的
 */
function Draw_Text()
{
	Draw_Normal.apply(this, arguments);
	// 房间图片样式
	this.drawable = null;
}
extend_usemid(Draw_Text, Draw_Normal);

/**
 * 画文字
 */
Draw_Text.prototype.draw = function()
{
	if (this.drawable !== null && this.drawable !== "")
	{
		// 一些条件满足才画
		if (this.position !== undefined && this.position !== null
				&& this.position.x !== undefined && this.position.x !== null
				&& this.position.y !== undefined && this.position.y !== null)
		{
			var x = this.position.x + this.position.dx;
			var y = this.position.y + this.position.dy;

			this.ctx.fillStyle = "#cecece";
			this.ctx.font = '12pt Calibri';
			this.ctx.fillText(this.drawable, x, y);
		}
	}

}
